﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UI/HRManagerUI/HrManager.Master"
    AutoEventWireup="true" CodeBehind="AddTraining.aspx.cs" Inherits="HRM.UI.HRManagerUI.TrainingUI.AddTraining" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContentBody" runat="server">
    <link href="../../../Styles/Training/AddTrainingCss.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/htmlDatePicker.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/htmlDatePicker.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">

        function CheckField() {
            if (document.getElementById("<%=txtTraingName.ClientID%>").value == "") {
                document.getElementById("<%=lblMsg.ClientID%>").textContent = "Please Enter Training Name!";
                document.getElementById("<%=lblMsg.ClientID%>").style.color = "red";
                document.getElementById("<%=txtTraingName.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtDepartment.ClientID%>").Value == "") {
                document.getElementById("<%=lblMsg.ClientID%>").textContent = "Please Enter Department Name!";
                document.getElementById("<%=lblMsg.ClientID%>").style.color = "red";
                document.getElementById("<%=txtDepartment.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtTopice.ClientID%>").Value == "") {
                document.getElementById("<%=lblMsg.ClientID%>").textContent = "Please Enter a topics Name!";
                document.getElementById("<%=lblMsg.ClientID%>").style.color = "red";
                document.getElementById("<%=txtTopice.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtStartDate.ClientID%>").Value == "") {
                document.getElementById("<%=lblMsg.ClientID%>").textContent = "Please Select Training start date";
                document.getElementById("<%=lblMsg.ClientID%>").style.color = "red";
                document.getElementById("<%=txtStartDate.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=txtEndDate.ClientID%>").Value == "") {
                document.getElementById("<%=lblMsg.ClientID%>").textContent = "Please Select Training Ending date";
                document.getElementById("<%=lblMsg.ClientID%>").style.color = "red";
                document.getElementById("<%=txtEndDate.ClientID%>").focus();
                return false;
            }
            return true;
        }
  

    </script>
    <table class="addTrainingTb">
        <tr>
            <td colspan="2" align="center">
                <asp:Label runat="server" ID="lblMsg"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="Title">
                Add Training
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                Training Name
            </td>
            <td class="inputfield">
                <input type="text" runat="server" id="txtTraingName" class="textboxinput" /><span
                    class="estaricStar">*</span>
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                Department
            </td>
            <td class="inputfield">
                <input type="text" runat="server" id="txtDepartment" class="textboxinput" /><span
                    class="estaricStar">*</span>
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                Trainer
            </td>
            <td class="inputfield">
                <input type="text" runat="server" id="txtTrainer" class="textboxinput" />
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                Topices
            </td>
            <td class="inputfield">
                <input type="text" runat="server" id="txtTopice" class="textboxinput" /><span class="estaricStar">*</span>
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                Venu
            </td>
            <td class="inputfield">
                <input type="text" runat="server" id="txtVenue" class="textboxinput" />
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                Start Date
            </td>
            <td class="inputfield">
                <input type="text" runat="server" id="txtStartDate" readonly onclick="GetDate(this);"
                    class="textboxinput" /><span class="estaricStar">*</span>
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                End Date
            </td>
            <td class="inputfield">
                <input type="text" runat="server" id="txtEndDate" readonly onclick="GetDate(this);"
                    class="textboxinput" /><span class="estaricStar">*</span>
            </td>
        </tr>
        <tr>
            <td class="labelfield">
                Description
            </td>
            <td class="inputfield">
                <textarea runat="server" id="txtDescription" cols="25" rows="2" class="inputTextarea"></textarea>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <input type="submit" runat="server" value="Save Training" onserverclick="SaveTraining"
                    class="btnCss" onclick="return CheckField()" />
            </td>
        </tr>
    </table>
    <div align="center">
        <asp:Label runat="server" ID="lblDelete"></asp:Label></div>
    <asp:GridView runat="server" ID="allTrainingGdv" Width="100%" AutoGenerateColumns="False"
        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" CssClass="GridviewStyle"
        OnRowCancelingEdit="allTrainingGdv_RowCancelingEdit" OnRowDeleting="allTrainingGdv_RowDeleting"
        OnRowEditing="allTrainingGdv_RowEditing" OnRowUpdating="allTrainingGdv_RowUpdating"
        AllowPaging="True" PageSize="2" 
        onpageindexchanging="allTrainingGdv_PageIndexChanging">
        <Columns>
            <asp:TemplateField HeaderText="Id" Visible="False">
                <ItemTemplate>
                    <asp:Label ID="lblId" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name">
                <EditItemTemplate>
                    <asp:TextBox ID="txtTrainingName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Department">
                <EditItemTemplate>
                    <asp:TextBox ID="txtDepartmentname" runat="server" Text='<%# Bind("Department") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Department") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Trainer">
                <EditItemTemplate>
                    <asp:TextBox ID="txtTrainerName" runat="server" Text='<%# Bind("Trainer") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("Trainer") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Topics">
                <EditItemTemplate>
                    <asp:TextBox ID="txtTopics" runat="server" Text='<%# Bind("Topics") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("Topics") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Venue">
                <EditItemTemplate>
                    <asp:TextBox ID="txtVenueName" runat="server" Text='<%# Bind("Venue") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("Venue") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Start Date">
                <EditItemTemplate>
                    <asp:TextBox ID="txtStartDate" runat="server" Text='<%# Bind("StartDate") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("StartDate") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="End Date">
                <EditItemTemplate>
                    <asp:TextBox ID="txtEndDate" runat="server" Text='<%# Bind("EndDate") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("EndDate") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Description">
                <EditItemTemplate>
                    <asp:TextBox ID="txtDescription" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField HeaderText="Edit" ShowEditButton="True" />
            <asp:TemplateField HeaderText="Delete">
                <ItemTemplate>
                    <asp:LinkButton runat="server" ID="linkRemove" CommandArgument='<%# Bind("Id")%>'
                        CommandName="Delete" Text="Delete" OnClientClick="return confirm('Do you want to delete this Training?')">
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle CssClass="GridViewFooterStyle" />
        <HeaderStyle Font-Bold="True" CssClass="GridViewHeaderStyle" />
        <PagerStyle HorizontalAlign="Center" CssClass="GridViewFooterStyle" />
        <RowStyle ForeColor="#000066" />
        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#007DBB" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#00547E" />
    </asp:GridView>
</asp:Content>
